package com.miku.blog.controller;

import com.miku.blog.annotation.SystemLog;
import com.miku.blog.domain.pojo.ResponseResult;
import com.miku.blog.service.OperationLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @author shkstart
 * @create ${}YEAR-06-06 21:01
 */
@Api(tags = "后台管理系统[日志]")
@RequestMapping("/admin")
@RestController
public class OperationLogController {

    @Autowired
    private OperationLogService operationLogService;


    @SystemLog(notes = "获取操作日志列表{后台管理系统}")
    @ApiOperation(value = "获取操作日志列表接口")
    @GetMapping("/operation/logs")
    public ResponseResult getOperationLogs(@RequestParam("current")Integer current,
                                           @RequestParam("size")Integer size,
                                           @RequestParam(value = "keywords",required = false)String keywords){
        return operationLogService.getOperationLogs(current,size,keywords);
    }


    @SystemLog(notes = "删除(物理)操作日志列表{后台管理系统}")
    @ApiOperation(value = "删除(物理)操作日志列表接口")
    @DeleteMapping("/operation/logs")
    public ResponseResult deleteOperationLogs(@RequestBody Integer[] operationLogIdList){
        return operationLogService.deleteOperationLogs(operationLogIdList);
    }

}
